package com.weimob.mcloud.wechatwork.customer.service.user.enums.sidebar;

import lombok.Getter;

import java.util.Objects;

/**
 * 营销活动映射枚举
 *
 * @author WEIMOB
 */
@Getter
public enum CampaignCategoryEnum {

    /**
     * 促销活动
     */
    SALES_PROMOTION("salesPromotion", "促销活动"),

    /**
     * 互动营销
     */
    INTERACTIVE_MARKETING("interactiveMarketing", "互动营销"),

    /**
     * 会员营销
     */
    MEMBER_MARKETING("memberMarketing", "会员营销"),


    ;

    /**
     * 活动种类
     * salesPromotion	促销活动
     * interactiveMarketing	互动营销
     * memberMarketing	会员营销
     */
    private String code;

    private String desc;

    CampaignCategoryEnum(String code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    /**
     * 根据code查询对应的枚举
     *
     * @param code
     * @return
     */
    public static CampaignCategoryEnum valueOfCode(String code) {
        for (CampaignCategoryEnum campaignCategoryEnum : CampaignCategoryEnum.values()) {
            if (Objects.equals(campaignCategoryEnum.getCode(), code)) {
                return campaignCategoryEnum;
            }
        }
        return null;
    }

}
